import React from 'react'
import { useRef } from 'react'

export default function Child({setList}) {
  const inputRef = useRef(null)
  const handler = () => {
    setList((list)=>{
      return [...list, inputRef.current.value]
    })
  }
  return (
    <div>
      <div className="hd">
        <input type="text" ref={inputRef} />
        <button onClick={handler}>确认</button>
      </div>
    </div>
  )
}
